<template>
	<view class="order-detail">
		<lj-top-tip type="warning" text="处方待审核中" v-if="info.status == 'normal'"></lj-top-tip>
		<lj-top-tip type="success" text="处方审核已通过" v-if="info.status == 'yes'"></lj-top-tip>
		<lj-top-tip type="danger" text="处方审核已驳回" v-if="info.status == 'reject'"></lj-top-tip>
		
		<view class="content">
			<view class="card">
				<view class="head u-flex u-flex-between">
					<view class="u-flex">
						<image src="/static/lj/common/icon_diagnosticname.png" mode="aspectFill"></image>
						<view>电子处方</view>
					</view>
					<view class="lookbtn u-flex" @click="goNext('/pagesA/prescript/note?id=' + info.id + '&mode=ys')">
						<view>查看原始处方</view>
						<u-icon name="arrow-right"></u-icon>
					</view>
				</view>
			</view>
			
			<view class="card">
				<view class="cellbox">
					<view class="item u-flex">
						<view class="label">患者信息：</view>
						<view>
							<!-- {backgroundImage: 'url(' + photo + ')'} -->
							<text class="name">{{info.user_the_patient_info?info.user_the_patient_info.name:''}}</text>
							<text class="phone">{{info.user_the_patient_info?info.user_the_patient_info.mobile:''}}</text>
						</view>
					</view>
					<view class="item u-flex">
						<view class="label">诊断医生：</view>
						<view class="name">{{info.doctor_info?info.doctor_info.name:''}}</view>
						<view class="phone">{{info.doctor_info?info.doctor_info.mobile:''}}</view>
					</view>
					<view class="item u-flex">
						<view class="label">诊断结果：</view>
						<view>{{info.diagnose ? info.diagnose : '暂无'}}</view>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="head u-flex u-flex-between">
					<view class="u-flex">
						<image src="/static/lj/common/icon_prescription.png" mode="aspectFill"></image>
						<view>处方</view>
					</view>
				</view>
				<view class="part3">
					<view class="item u-flex u-flex-between u-flex-y-center" v-for="(item, index) in info.doctor_prescription_list" :key="index">
						<!-- {backgroundImage: 'url(' + item.goods_logo + ')'} -->
						<view>
							<view class="tit">
								<text>{{item.goods_name}}</text>
								<text style="margin-left: 16rpx;">{{item.spec_name}}</text>
							</view>
							<view class="con">
								用法用量：{{item.frequencys}}，{{item.consumptions}}，{{item.usages}}
							</view>
							<view class="con">
								备注：{{item.remark||'--'}}
							</view>
						</view>
						<view class="price">
							￥{{item.goods_price}}×{{item.number}}
						</view>
					</view>
					
					<view class="total-price">
						合计金额：<text style="color: #ff4c00;">￥{{info.pay_price}}</text>
					</view>
				</view>
			</view>
			
			<!-- 审核药师 -->
			<view class="card pharmacist u-flex" v-if="info.status != 'normal'">
				<image class="avatar" :src="$base.cdn(info&&info.pharmacist_info?info.pharmacist_info.img:'','/static/lj/common/default-doctor.png')" mode="aspectFill"></image>
				<view>
					<view class="name">审核药师：{{info.pharmacist_info?info.pharmacist_info.name:''}}<text style="margin-left: 40rpx;">{{info.pharmacist_info?info.pharmacist_info.mobile:''}}</text></view>
					<view class="font12 font-969696" style="margin-top: 10rpx;">审核时间：{{info.pharmacist_time}}</view>
					<view class="font12 font-969696" style="margin-top: 10rpx;" v-if="info.status=='reject'">驳回原因：{{info.reject_content}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				photo: require('../../static/my/portrait.png'),
				info: {}
			}
		},
		onLoad: function(options) {
			let $this = this

			this.$Http({
				url: 'mydetailsPrescription',
				data: {doctor_prescription_id: options.id}
			}).then(res => {
				if (res.code == 1) {
					res.data.doctor_info.img = $this.$store.state.http_img + res.data.doctor_info.img
					res.data.pharmacist_time = res.data.pharmacist_time ? $this.$base.formatTime(new Date(res.data.pharmacist_time * 1000), 'yyyy-MM-dd hh:mm:ss') : ''
					res.data.goods_list.forEach((item)=>{
						item.goods_img = $this.$store.state.http_img + item.goods_img
					})
					$this.info = res.data
				} else {
					uni.showToast({ title: res.msg, icon: 'none' })
				}
			})
		},
		methods: {
			// 跳转
			goNext (url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="less">
	@import url("style.less");
	
	page{
		background-color: #f6f6f6;
		font-size: 26rpx;
	}
	.content{
		padding: 0 30rpx 112rpx;
		.card{
			padding: 20rpx;
			background-color: #fff;
			border-radius: 10rpx;
			margin-top: 20rpx;
			
			.head{
				padding-left: 10rpx;
				
				image{
					display: block;
					width: 34rpx;
					min-width: 34rpx;
					height: 40rpx;
					margin-right: 16rpx;
				}
				
				.lookbtn{
					color: #999999;
				}
			}
			
			.cellbox{
				.item{
					padding: 10rpx 0;
					.label{
						width: 152rpx;
						min-width: 152rpx;
						color: #666666;
					}
					.name{}
					.phone{
						margin-left: 24rpx;
					}
				}
				
			}
			
			.part3{
				padding-bottom: 18rpx;
				.item{
					border-radius: 6rpx;
					background-color: #f9f9f9;
					padding: 16rpx 20rpx;
					padding-right: 26rpx;
					margin-top: 20rpx;
					.tit{
						color: #666666;
					}
					.con{
						font-size: 24rpx;
						color: #999999;
					}
					.price{
						font-size: 24rpx;
						color: #999999;
					}
				}
				
				.total-price{
					text-align: right;
					margin-top: 20rpx;
				}
			}
			
			&.pharmacist{
				.avatar{
					display: block;
					width: 96rpx;
					min-width: 96rpx;
					height: 96rpx;
					margin-right: 20rpx;
				}
			}
		}
	}
	
	.fix-bottom-btn{
		padding: 0 30rpx;
		background-color: #f6f6f6;
	}
	.fix-bottom-btn .btn.l, .fix-bottom-btn .btn.r{
	    width: 306rpx;
		height: 74rpx;
		line-height: 70rpx;
		text-align: center;
	    background-color: #fff;
	    color: #dc830f;
		border: 2rpx solid #dc830f;
		margin: 0;
	}
	.fix-bottom-btn .btn.r {
	    color: #27bb76;
		border: 2rpx solid #3dc787;
	}
</style>
